package com.audaque.springboot.foshanupload.casclientautoconfigsupport.component;

/**
 * @author zgb
 * @desc ...
 * @date 2021-12-25 00:12:04
 */


import com.audaque.springboot.foshanupload.casclientautoconfigsupport.properties.ServerProperties;
import com.audaque.springboot.foshanupload.casclientautoconfigsupport.properties.ServiceProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class ServerUrlProvider {
    @Autowired
    private ServerProperties serverProperties;

    @Autowired
    private ServiceProperties serviceProperties;


    public String getServerLoginUrl() {
        StringBuilder sb = new StringBuilder();
        String serverLoginUrl = serviceProperties.getServerLoginUrl();
        sb.append(serverLoginUrl);
        sb.append("?service=");
        String clientLoginUrl = serviceProperties.getClientLoginUrl();
        sb.append(clientLoginUrl);
        sb.append("?serviceRedirectUrl=");
        String serviceRedirectUrl = serviceProperties.getServiceRedirectUrl();
        sb.append(serviceRedirectUrl);
        String s = sb.toString();
        return s;
    }

    public String getServerLogoutUrl() {
        StringBuilder sb = new StringBuilder();
        String serverLogoutUrl = serviceProperties.getServerLogoutUrl();
        sb.append(serverLogoutUrl);
        sb.append("?service=");
        String clientLogoutUrl = serviceProperties.getClientLogoutUrl();
        sb.append(clientLogoutUrl);
        sb.append("?serviceRedirectUrl=");
        String serviceRedirectUrl = serviceProperties.getServiceRedirectUrl();
        sb.append(serviceRedirectUrl);
        String s = sb.toString();
        return s;
    }


}
